import http from '@/utils/http'

// 登陆
export function login(form) {
  return http.post('/login', form)
}

// 获取用户信息
export function getInfo(token) {
  return http({
    url: '/login/info',
    method: 'post',
    params: { token }
  })
}

// 退出
export function logout() {
  return http({
    url: '/login/logout',
    method: 'post'
  })
}

// 获取用户信息
export function getUserInfo(token) {
  return http({
    url: '/login/getUser',
    method: 'post',
    params: { token }
  })
}


// 获取用户信息
export function getEmailCode(email, type) {
  return http.post('/login/sendcode', { email, type })
}

export function resetPassword(form) {
  return http.post('/login/resetPassword', form)
}

export function register(form) {
  return http.post('/login/register', form)
}
// export function getIp(){
// 	var xmlHttp = new XMLHttpRequest();
// 	var url = 'http://myip.ipip.net/'
// 	xmlHttp.open("GET",url,false)
// 	xmlHttp.send(null)
// 	return xmlHttp.responseText
// }